package com.hp.team.bookstore.model.profile;

import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "CREDIT_CARD")
public class CreditCard {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID")
	private long id;

	@Enumerated(EnumType.STRING)
	@Column(name = "TYPE")
	private CreditCardType type;

	@Column(name = "NAME_ON_CARD")
	private String nameOnCard;

	@Column(name = "CARD_NUMBER")
	private long cardNumber;

	@Column(name = "SECURITY_CODE")
	private int securityCode;

	@Temporal(TemporalType.DATE)
	@Column(name = "EXPIRATION_DATE")
	private Calendar expirationDate;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "CUSTOMER_ID", nullable = true)
	private Customer customer;

	public void setId(long id) {
		this.id = id;
	}

	public void setType(CreditCardType type) {
		this.type = type;
	}

	public void setNameOnCard(String nameOnCard) {
		this.nameOnCard = nameOnCard;
	}

	public void setCardNumber(long cardNumber) {
		this.cardNumber = cardNumber;
	}

	public void setSecurityCode(int securityCode) {
		this.securityCode = securityCode;
	}

	public void setExpirationDate(Calendar expirationDate) {
		this.expirationDate = expirationDate;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public long getId() {
		return id;
	}

	public CreditCardType getType() {
		return type;
	}

	public String getNameOnCard() {
		return nameOnCard;
	}

	public long getCardNumber() {
		return cardNumber;
	}

	public int getSecurityCode() {
		return securityCode;
	}

	public Calendar getExpirationDate() {
		return expirationDate;
	}

	public Customer getCustomer() {
		return customer;
	}
}
